<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewpoint" content="width=device-width, initial-scale=1.0">
    <title>分类</title>
    <link href="https://cdn.bootcss.com/semantic-ui/2.4.1/semantic.min.css" rel="stylesheet">
    <link href="../static/css/myCss.css" rel="stylesheet">
</head>
<body>
<nav th:replace="_fragments :: menu(2)" class="ui inverted attached segment my-padding-tb-mini my-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary menu stackable">
            <h2 class="ui header teal item">Blog</h2>
            <a href="#"  class="my-item item my-mobile-hide">首页</a>
            <a href="#" class="my-item item my-mobile-hide">标签</a>
            <a href="#" class="active my-item item my-mobile-hide">分类</a>
            <a href="#" class="my-item item my-mobile-hide">归档</a>
            <a href="#" class="my-item item my-mobile-hide">关于我</a>

            <div class="right item">
                <div>
                    <div class="ui icon inverted transparent input">
                        <input type="text" placeholder="搜索">
                        <i class="search link icon"></i>

                    </div>
                </div>

                <button class="ui button" style="margin-left: 1em !important;">注册/登陆</button>
            </div>

        </div>
    </div>
    <a href="#" class="menu tooggle ui icon black button my-top-right my-mobile-show"><i class="sidebar icon"></i></a>
</nav>


<div class="my-padding-tb-large my-container-small">
    <div class="ui container">
        <div class="animated fadeInUp">
            <!--        头部 header-->
            <div class="ui segment top attached ">
                <div class="ui middle aligned two column grid  ">
                    <div class="column">
                        <div class="ui teal header">分类</div>
                    </div>

                    <!--标签总量-->
                    <div class="column right aligned">
                        共 <span id="article-number" class="ui header orange" th:text="${#arrays.length(types)}">需要替代文字</span>个
                    </div>
                </div>
            </div>

            <!--        标签-->
            <div class="ui segment attached my-padding-tb-large">
                <div class="ui button labeled my-margin-tb-tiny" th:each="type : ${types}">
                    <a class="ui basic button teal" href="#" th:href="@{/types/{id}(id=${type.id})}" th:classappend="${type.id==activeTypeId} ? 'teal'" th:text="${type.typeName}">言少是狗</a>
                    <div class="ui label basic left pointing teal" th:classappend="${type.id==activeTypeId} ? 'teal'" th:text="${#arrays.length(type.blogs)}">254</div>
                </div>
            </div>
        </div>


        <!--        文章列表-->
        <div class="ui segment top attached teal animated fadeInUp">
            <div class="ui vertical segment" th:each="blog : ${page.content}">
                <!--                文章-->
                <div class="ui grid stackable mobile reversed attached">

                    <!--文章相关信息-->
                    <div class="eleven wide column">
                        <h3 class="ui header" ><a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black" th:text="${blog.title}">你真的理解什么是财富自由吗?</a></h3>
                        <p class="m-text" th:text="|${blog.description}......|">正确做好任何一件事情的前提是清晰、正确的理解目标。而事实是，我们很多人很多时候根本没有对目标正确的定义，甚至根本从来就没有想过，只是大家都那么做而已…...</p>
                        <div class="ui grid">
                            <div class="eleven wide column">
                                <div class="ui mini horizontal link list">
                                    <div class="item">
                                        <img src="https://unsplash.it/100/100?image=1005" th:src="@{${blog.user.avatar}}"  alt="" class="ui avatar image">
                                        <div class="content"><a href="#" class="header" th:text="${blog.user.nickname}" >张泽</a></div>
                                    </div>
                                    <div class="item">
                                        <i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2017-10-01</span>
                                    </div>
                                    <div class="item">
                                        <i class="eye icon"></i> <span th:text="${blog.viewNum}">2342</span>
                                    </div>
                                </div>
                            </div>
                            <div class="right aligned five wide column">
                                <a href="#" target="_blank" class="ui teal basic label m-padded-tiny m-text-thin" th:text="${blog.type.typeName}">认知升级</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
        <!--footer-->
        <div class="ui bottom attached segment" th:if="${page.totalPages}>1">
            <div class="ui middle aligned two column grid">
                <div class="column">
                    <a href="#" th:href="@{'/types/'+${activeTypeId}(page=${page.number}-1)}"  th:unless="${page.first}" class="ui mini teal basic button">上一页</a>
                </div>
                <div class="right aligned column">
                    <a href="#" th:href="@{'/types/'+${activeTypeId}(page=${page.number}+1)}"  th:unless="${page.last}" class="ui mini teal basic button">下一页</a>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/semantic-ui/2.4.1/semantic.min.js"></script>
<script>
    $('.menu.tooggle').click(function () {
        $('.my-item').toggleClass('my-mobile-hide');
    });
</script>
</body>
</html>